import { AddCustomAttribute, BaseAttribute, GetTypeOf } from "../../../../../Decorator/Decorator";
import { PanelId } from "../../Demo/FUIAutoGen/PanelId";
import { PanelInfo } from "./FUIEventComponent";

export function FUIEvent(PanelId: PanelId, packageName: string, componentName: string) {
    return function (baseClazz) {

        BaseAttribute(GetTypeOf(FUIEventAttribute), baseClazz);

        let type = baseClazz.name;
        let data = new FUIEventAttribute(PanelId, packageName, componentName);
        AddCustomAttribute(type, data);

        // console.log(`FUIEvent`);
        // console.log(baseClazz);
        // console.log(PanelId);
        // console.log(packageName);
        // console.log(componentName);
        // console.log(data);
    }
}


export class FUIEventAttribute {

    public get PanelId(): PanelId {
        return this.panelId;
    }

    private penelInfo: PanelInfo;
    public get PanelInfo(): PanelInfo {
        return this.penelInfo;
    }

    constructor(private panelId: PanelId, private packageName: string, private componentName: string) {
        this.penelInfo =
        {
            PanelId: panelId,
            PackageName: packageName,
            ComponentName: componentName
        }
    }

}